<?php

namespace app\api\controller;

use app\admin\model\AdminLog;
use app\common\controller\Api;
use app\common\model\User;
use think\Db;
use think\Validate;

/**
 * 首页接口
 */
class Index extends Api
{
    protected $noNeedLogin = ["*"];
    protected $noNeedRight = ['*'];


//    public function test()
//    {
//        $teachers = \app\common\model\Teacher::where('school_id', 56)->column('user_id,card_number', 'card_number');
//
//        //echo count($teachers);die;
//
//        $logs = AdminLog::where('username', 'changcheng')
//            ->whereLike('url', '%teacher/add%')
//            ->column('content');
//
//
//        foreach ($logs as $key => $log) {
//            $data = json_decode($log, true);
//
//            if (Validate::regex($data['user']['mobile'], "^1\d{10}$")) {
//                $user = User::where('mobile', $data['user']['mobile'])->find();
//
//                if (!$user) {
//                    $user = \app\common\model\User::createUser($data['user']['mobile'], $data['row']['name'], ['mobile'=>$data['user']['mobile'],'avatar' => $data['row']['avatar'], 'gender'=> $data['row']['gender'], 'school_id' => $data['row']['school_id']]);
//                }
//
//                \app\common\model\Teacher::where('school_id', 56)
//                    ->where('card_number', $data['row']['card_number'])
//                    ->update(['user_id'=>$user->id]);
//            }
//
//        }
//
//        //$user = \app\common\model\User::getUser($user_params['mobile'], $user_params['nickname'], ['avatar' => $user_params['avatar'], 'gender'=> $user_params['gender'], 'school_id' => $this->auth->school_id]);
//
//
//        $this->success('', compact('logs', 'teachers'));
//
//    }



}
